function [targetStrings] = HR_FindAllTargetStrings(s1NrTargets, s1OlTargets, s2NrTargets, s2OlTargets)
%HR_FindAllTargetStrings Summary of this function goes here
%   Detailed explanation goes here

nrt = [s1NrTargets s2NrTargets];

i = 1;
jump = 1;

for a = 1:2
  for b = 1:nrt(a)
    if (a == 1)
      s = 2;
      s1t = b;
      s2t = 1;
      targetString = s1OlTargets(b);
    else
      s = 1;
      s1t = 1;
      s2t = b;
      targetString = s2OlTargets(b);
    end
    j = 1;
    found = 0;
    s1t_temp = s1t;
    s2t_temp = s2t;
    while 1
      if (s == 1)
        if (s1t > s1NrTargets)
          if (s2t > s2NrTargets)
            break;
          else
            jump = jump + 1;
            s1t = s1t_temp;
            s2t = s2t_temp;
            
            if ((s2t + jump) > s2NrTargets)
              break;
            end
            targetString(j) = s2OlTargets(s2t + jump);
            s2t = s2t + jump + 1;
          end
        elseif (s1OlTargets(s1t) == targetString(j))
          found = 1;
          jump = 1;
          if ((s1t + jump) > s1NrTargets)
            break;
          end
          j = j + 1;
          found = 0;
          targetString(j) = s1OlTargets(s1t + jump); %#ok<*AGROW>
          s = 2;
          s1t_temp = s1t;
          s2t_temp = s2t;
          s1t = s1t + jump + 1;
        else
          s1t = s1t + 1;
        end
      else
        if (s2t > s2NrTargets)
          if (s1t > s1NrTargets)
            break;
          else
            jump = jump + 1;
            s1t = s1t_temp;
            s2t = s2t_temp;
            
            if ((s1t + jump) > s1NrTargets)
              break;
            end
            targetString(j) = s1OlTargets(s1t + jump);
            s1t = s1t + jump + 1;
          end
        elseif (s2OlTargets(s2t) == targetString(j))
          found = 1;
          jump = 1;
          if ((s2t + jump) > s2NrTargets)
            break;
          end
          j = j + 1;
          found = 0;
          targetString(j) = s2OlTargets(s2t + jump);
          s = 1;
          s1t_temp = s1t;
          s2t_temp = s2t;
          s2t = s2t + jump + 1;
        else
          s2t = s2t + 1;
        end
      end
    end
    if ~found
      targetString = targetString(1:size(targetString, 2)-1);
    end
    if size(targetString, 2) > 0
      targetStrings(i).string = targetString;
      i = i + 1;
    end
  end
end
end